
uniform mat4 matModelViewProj;                                               
uniform mat4 matModelView;                                                   
uniform mat4 matModelViewInverseTranspose;                                   
uniform vec3 vecEyePositionWorld;                                            
uniform vec3 vecLightPositionWorld; 

attribute vec4 a_position;                                                   
attribute vec3 a_normal;                                                     
attribute vec2 a_texCoord;                                                   

varying vec3 vNormal;                                                        
varying vec3 vViewVec;                                                       
varying vec3 vLightVec;                                                      
varying vec2 vTexCoord;

void main()                                                                  
{   
	// Vertex position
	gl_Position = matModelViewProj * a_position; 
	
	// Texture coordinete
	vTexCoord   = a_texCoord;
	
	// Vectors for lighting
	vec4 position =  matModelView * a_position;
	vec3 lightDirectionWorld = vecLightPositionWorld - position.xyz;
	vLightVec   = normalize( lightDirectionWorld );
	
	vNormal     = vec3(matModelViewInverseTranspose * vec4(a_normal, 0.0));
	vViewVec    = -vec3(matModelView * a_position);
}



